Imports Castle.ActiveRecord

Namespace Model
    ''' <summary>
    '''	Gerado por MyGeneration usando o template ActiveRecord Object Mapper-1.0.3
    '''	Criado em 14/08/2010 00:29:39
    ''' </summary>
    ''' <remarks></remarks>

    <Serializable(), ActiveRecord("nf", DynamicUpdate:=True)> _
    Public Class Nf
        Inherits ActiveRecordBase(Of Model.Nf)

        ' PK
        Private _cd_nf As Integer

        ' FKs
        Private _PessoaEmpresa As Model.Pessoa
        Private _Cfop As Cfop
        Private _PessoaCliente As Model.Pessoa
        Private _PessoaTransportadora As Model.Pessoa
        Private _Estado As Model.Estado
        Private _Municipio As Model.Municipio

        Private _nf_modelo As String
        Private _nf_serie As Short
        Private _nf_numero As Long
        Private _nf_emissao As Date
        Private _nf_tipo_documento As Short
        Private _nf_tipo_imp_danfe As Short
        Private _nf_saida_entrada As Date
        Private _nf_forma_pagamento As Short
        Private _nf_forma_emissao As Short
        Private _nf_finalidade As Short
        Private _nf_faturado As Date

        Private _nf_total_produto As Decimal
        Private _nf_total As Decimal

        Private _nf_total_icms_base As Decimal
        Private _nf_total_icms As Decimal
        Private _nf_total_icmsst_base As Decimal
        Private _nf_total_icmsst As Decimal
        Private _nf_total_pis_base As Decimal
        Private _nf_total_pis As Decimal
        Private _nf_total_pisst_base As Decimal
        Private _nf_total_pisst As Decimal
        Private _nf_total_cofins_base As Decimal
        Private _nf_total_cofins As Decimal
        Private _nf_total_cofinsst_base As Decimal
        Private _nf_total_cofinsst As Decimal
        Private _nf_total_ii_base As Decimal
        Private _nf_total_ii As Decimal
        Private _nf_total_ipi_base As Decimal
        Private _nf_total_ipi As Decimal
        Private _nf_total_desconto As Decimal
        Private _nf_total_outras_despesas As Decimal
        Private _nf_total_issqn_base As Decimal
        Private _nf_total_issqn As Decimal
        Private _nf_total_issqn_pis As Decimal
        Private _nf_total_issqn_cofins As Decimal

        Private _nf_frete As Decimal
        Private _nf_thc As Decimal
        Private _nf_seguro As Decimal
        Private _nf_siscomex As Decimal
        Private _nf_despadu As Decimal
        Private _nf_prest_perc As Decimal
        Private _nf_prest_total As Decimal

        Private _nf_nfe_chave As String
        Private _nf_nfe_protocolo As String
        Private _nf_nfe_status As String
        Private _nf_nfe_processamento As String
        Private _nf_nfe_retorno_sefaz As String
        Private _nf_observacao As String

        ' List
        Private _Nfitems As IList(Of Model.Nfitem) = New List(Of Model.Nfitem)
        Private _Nfretornos As IList(Of Model.Nfretorno) = New List(Of Model.Nfretorno)

        <PrimaryKey(PrimaryKeyType.Sequence, SequenceName:="nf_cd_nf_seq")> _
        Public Property cd_nf() As Integer
            Get
                Return _cd_nf
            End Get
            Set(ByVal value As Integer)
                _cd_nf = value
            End Set
        End Property

        <BelongsTo("cd_cfop")> _
        Public Property Cfop() As Cfop
            Get
                Return _Cfop
            End Get
            Set(ByVal value As Cfop)
                _Cfop = value
            End Set
        End Property

        <BelongsTo("cd_pessoa_empresa")> _
        Public Property PessoaEmpresa() As Model.Pessoa
            Get
                Return _PessoaEmpresa
            End Get
            Set(ByVal value As Model.Pessoa)
                _PessoaEmpresa = value
            End Set
        End Property

        <BelongsTo("cd_pessoa_cliente")> _
        Public Property PessoaCliente() As Model.Pessoa
            Get
                Return _PessoaCliente
            End Get
            Set(ByVal value As Model.Pessoa)
                _PessoaCliente = value
            End Set
        End Property

        <BelongsTo("cd_pessoa_transportadora")> _
        Public Property PessoaTransportadora() As Model.Pessoa
            Get
                Return _PessoaTransportadora
            End Get
            Set(ByVal value As Model.Pessoa)
                _PessoaTransportadora = value
            End Set
        End Property

        <BelongsTo("cd_estado")> _
                Public Property Estado() As Model.Estado
            Get
                Return _Estado
            End Get
            Set(ByVal value As Model.Estado)
                _Estado = value
            End Set
        End Property

        <BelongsTo("cd_municipio")> _
                Public Property Municipio() As Model.Municipio
            Get
                Return _Municipio
            End Get
            Set(ByVal value As Model.Municipio)
                _Municipio = value
            End Set
        End Property




        <[Property]("nf_modelo")> _
        Public Property nf_modelo() As String
            Get
                Return _nf_modelo
            End Get
            Set(ByVal value As String)
                _nf_modelo = value
            End Set
        End Property

        <[Property]("nf_serie")> _
        Public Property nf_serie() As Short
            Get
                Return _nf_serie
            End Get
            Set(ByVal value As Short)
                _nf_serie = value
            End Set
        End Property

        <[Property]("nf_numero")> _
        Public Property nf_numero() As Long
            Get
                Return _nf_numero
            End Get
            Set(ByVal value As Long)
                _nf_numero = value
            End Set
        End Property

        <[Property]("nf_emissao", ColumnType:="Date")> _
        Public Property nf_emissao() As Date
            Get
                Return _nf_emissao
            End Get
            Set(ByVal value As Date)
                _nf_emissao = value
            End Set
        End Property
        <[Property]("nf_tipo_documento")> _
        Public Property nf_tipo_documento() As Short
            Get
                Return _nf_tipo_documento
            End Get
            Set(ByVal value As Short)
                _nf_tipo_documento = value
            End Set
        End Property
        <[Property]("nf_tipo_imp_danfe")> _
        Public Property nf_tipo_imp_danfe() As Short
            Get
                Return _nf_tipo_imp_danfe
            End Get
            Set(ByVal value As Short)
                _nf_tipo_imp_danfe = value
            End Set
        End Property

        <[Property]("nf_saida_entrada", ColumnType:="Date")> _
        Public Property nf_saida_entrada() As Date
            Get
                Return _nf_saida_entrada
            End Get
            Set(ByVal value As Date)
                _nf_saida_entrada = value
            End Set
        End Property

        <[Property]("nf_forma_pagamento")> _
        Public Property nf_forma_pagamento() As Short
            Get
                Return _nf_forma_pagamento
            End Get
            Set(ByVal value As Short)
                _nf_forma_pagamento = value
            End Set
        End Property

        <[Property]("nf_forma_emissao")> _
        Public Property nf_forma_emissao() As Short
            Get
                Return _nf_forma_emissao
            End Get
            Set(ByVal value As Short)
                _nf_forma_emissao = value
            End Set
        End Property

        <[Property]("nf_finalidade")> _
        Public Property nf_finalidade() As Short
            Get
                Return _nf_finalidade
            End Get
            Set(ByVal value As Short)
                _nf_finalidade = value
            End Set
        End Property
        <[Property]("nf_faturado", ColumnType:="Date")> _
        Public Property nf_faturado() As Date
            Get
                Return _nf_faturado
            End Get
            Set(ByVal value As Date)
                _nf_faturado = value
            End Set
        End Property

        <[Property]("nf_total_produto")> _
        Public Property nf_total_produto() As Decimal
            Get
                Return _nf_total_produto
            End Get
            Set(ByVal value As Decimal)
                _nf_total_produto = value
            End Set
        End Property

        <[Property]("nf_total")> _
        Public Property nf_total() As Decimal
            Get
                Return _nf_total
            End Get
            Set(ByVal value As Decimal)
                _nf_total = value
            End Set
        End Property

        <[Property]("nf_total_icms_base")> _
        Public Property nf_total_icms_base() As Decimal
            Get
                Return _nf_total_icms_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_icms_base = value
            End Set
        End Property

        <[Property]("nf_total_icms")> _
        Public Property nf_total_icms() As Decimal
            Get
                Return _nf_total_icms
            End Get
            Set(ByVal value As Decimal)
                _nf_total_icms = value
            End Set
        End Property

        <[Property]("nf_total_icmsst_base")> _
        Public Property nf_total_icmsst_base() As Decimal
            Get
                Return _nf_total_icmsst_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_icmsst_base = value
            End Set
        End Property

        <[Property]("nf_total_icmsst")> _
        Public Property nf_total_icmsst() As Decimal
            Get
                Return _nf_total_icmsst
            End Get
            Set(ByVal value As Decimal)
                _nf_total_icmsst = value
            End Set
        End Property

        <[Property]("nf_total_pis_base")> _
        Public Property nf_total_pis_base() As Decimal
            Get
                Return _nf_total_pis_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_pis_base = value
            End Set
        End Property

        <[Property]("nf_total_pis")> _
        Public Property nf_total_pis() As Decimal
            Get
                Return _nf_total_pis
            End Get
            Set(ByVal value As Decimal)
                _nf_total_pis = value
            End Set
        End Property

        <[Property]("nf_total_pisst_base")> _
        Public Property nf_total_pisst_base() As Decimal
            Get
                Return _nf_total_pisst_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_pisst_base = value
            End Set
        End Property

        <[Property]("nf_total_pisst")> _
        Public Property nf_total_pisst() As Decimal
            Get
                Return _nf_total_pisst
            End Get
            Set(ByVal value As Decimal)
                _nf_total_pisst = value
            End Set
        End Property

        <[Property]("nf_total_cofins_base")> _
        Public Property nf_total_cofins_base() As Decimal
            Get
                Return _nf_total_cofins_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_cofins_base = value
            End Set
        End Property

        <[Property]("nf_total_cofins")> _
        Public Property nf_total_cofins() As Decimal
            Get
                Return _nf_total_cofins
            End Get
            Set(ByVal value As Decimal)
                _nf_total_cofins = value
            End Set
        End Property

        <[Property]("nf_total_cofinsst_base")> _
        Public Property nf_total_cofinsst_base() As Decimal
            Get
                Return _nf_total_cofinsst_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_cofinsst_base = value
            End Set
        End Property

        <[Property]("nf_total_cofinsst")> _
        Public Property nf_total_cofinsst() As Decimal
            Get
                Return _nf_total_cofinsst
            End Get
            Set(ByVal value As Decimal)
                _nf_total_cofinsst = value
            End Set
        End Property

        <[Property]("nf_total_ii_base")> _
        Public Property nf_total_ii_base() As Decimal
            Get
                Return _nf_total_ii_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_ii_base = value
            End Set
        End Property

        <[Property]("nf_total_ii")> _
        Public Property nf_total_ii() As Decimal
            Get
                Return _nf_total_ii
            End Get
            Set(ByVal value As Decimal)
                _nf_total_ii = value
            End Set
        End Property

        <[Property]("nf_total_ipi_base")> _
        Public Property nf_total_ipi_base() As Decimal
            Get
                Return _nf_total_ipi_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_ipi_base = value
            End Set
        End Property

        <[Property]("nf_total_ipi")> _
        Public Property nf_total_ipi() As Decimal
            Get
                Return _nf_total_ipi
            End Get
            Set(ByVal value As Decimal)
                _nf_total_ipi = value
            End Set
        End Property

        <[Property]("nf_total_desconto")> _
        Public Property nf_total_desconto() As Decimal
            Get
                Return _nf_total_desconto
            End Get
            Set(ByVal value As Decimal)
                _nf_total_desconto = value
            End Set
        End Property

        <[Property]("nf_total_outras_despesas")> _
        Public Property nf_total_outras_despesas() As Decimal
            Get
                Return _nf_total_outras_despesas
            End Get
            Set(ByVal value As Decimal)
                _nf_total_outras_despesas = value
            End Set
        End Property

        <[Property]("nf_total_issqn_base")> _
        Public Property nf_total_issqn_base() As Decimal
            Get
                Return _nf_total_issqn_base
            End Get
            Set(ByVal value As Decimal)
                _nf_total_issqn_base = value
            End Set
        End Property

        <[Property]("nf_total_issqn")> _
        Public Property nf_total_issqn() As Decimal
            Get
                Return _nf_total_issqn
            End Get
            Set(ByVal value As Decimal)
                _nf_total_issqn = value
            End Set
        End Property

        <[Property]("nf_total_issqn_pis")> _
        Public Property nf_total_issqn_pis() As Decimal
            Get
                Return _nf_total_issqn_pis
            End Get
            Set(ByVal value As Decimal)
                _nf_total_issqn_pis = value
            End Set
        End Property

        <[Property]("nf_total_issqn_cofins")> _
        Public Property nf_total_issqn_cofins() As Decimal
            Get
                Return _nf_total_issqn_cofins
            End Get
            Set(ByVal value As Decimal)
                _nf_total_issqn_cofins = value
            End Set
        End Property


        <[Property]("nf_frete")> _
        Public Property nf_frete() As Decimal
            Get
                Return _nf_frete
            End Get
            Set(ByVal value As Decimal)
                _nf_frete = value
            End Set
        End Property

        <[Property]("nf_thc")> _
        Public Property nf_thc() As Decimal
            Get
                Return _nf_thc
            End Get
            Set(ByVal value As Decimal)
                _nf_thc = value
            End Set
        End Property

        <[Property]("nf_seguro")> _
        Public Property nf_seguro() As Decimal
            Get
                Return _nf_seguro
            End Get
            Set(ByVal value As Decimal)
                _nf_seguro = value
            End Set
        End Property

        <[Property]("nf_siscomex")> _
        Public Property nf_siscomex() As Decimal
            Get
                Return _nf_siscomex
            End Get
            Set(ByVal value As Decimal)
                _nf_siscomex = value
            End Set
        End Property

        <[Property]("nf_despadu")> _
        Public Property nf_despadu() As Decimal
            Get
                Return _nf_despadu
            End Get
            Set(ByVal value As Decimal)
                _nf_despadu = value
            End Set
        End Property

        <[Property]("nf_prest_perc")> _
        Public Property nf_prest_perc() As Decimal
            Get
                Return _nf_prest_perc
            End Get
            Set(ByVal value As Decimal)
                _nf_prest_perc = value
            End Set
        End Property

        <[Property]("nf_prest_total")> _
        Public Property nf_prest_total() As Decimal
            Get
                Return _nf_prest_total
            End Get
            Set(ByVal value As Decimal)
                _nf_prest_total = value
            End Set
        End Property

        <[Property]("nf_nfe_chave")> _
        Public Property nf_nfe_chave() As String
            Get
                Return _nf_nfe_chave
            End Get
            Set(ByVal value As String)
                _nf_nfe_chave = value
            End Set
        End Property

        <[Property]("nf_nfe_protocolo")> _
        Public Property nf_nfe_protocolo() As String
            Get
                Return _nf_nfe_protocolo
            End Get
            Set(ByVal value As String)
                _nf_nfe_protocolo = value
            End Set
        End Property

        <[Property]("nf_nfe_status")> _
        Public Property nf_nfe_status() As String
            Get
                Return _nf_nfe_status
            End Get
            Set(ByVal value As String)
                _nf_nfe_status = value
            End Set
        End Property

        <[Property]("nf_nfe_processamento")> _
        Public Property nf_nfe_processamento() As String
            Get
                Return _nf_nfe_processamento
            End Get
            Set(ByVal value As String)
                _nf_nfe_processamento = value
            End Set
        End Property

        <[Property]("nf_nfe_retorno_sefaz")> _
        Public Property nf_nfe_retorno_sefaz() As String
            Get
                Return _nf_nfe_retorno_sefaz
            End Get
            Set(ByVal value As String)
                _nf_nfe_retorno_sefaz = value
            End Set
        End Property

        <[Property]("nf_observacao")> _
        Public Property nf_observacao() As String
            Get
                Return _nf_observacao
            End Get
            Set(ByVal value As String)
                _nf_observacao = value
            End Set
        End Property

        <HasMany(GetType(Nfitem), Table:="nfitem", ColumnKey:="cd_nf", Inverse:=True, Cascade:=ManyRelationCascadeEnum.AllDeleteOrphan)> _
        Public Property Nfitem() As IList(Of Model.Nfitem)
            Get
                'If _Nfitems Is Nothing Then
                '_Nfitems = New List(Of Model.Nfitem)
                'End If
                Return _Nfitems
            End Get
            Set(ByVal value As IList(Of Model.Nfitem))
                If Not value Is _Nfitems Then
                    _Nfitems = value
                End If
            End Set
        End Property

        <HasMany(GetType(Model.Nfretorno), Table:="nfretorno", ColumnKey:="cd_nf", Inverse:=True, Cascade:=ManyRelationCascadeEnum.AllDeleteOrphan)> _
        Public Property Nfretorno() As IList(Of Model.Nfretorno)
            Get
                Return _Nfretornos
            End Get
            Set(ByVal value As IList(Of Model.Nfretorno))
                If Not value Is _Nfretornos Then
                    _Nfretornos = value
                End If
            End Set
        End Property
    End Class
End Namespace